LEGION Simulator API Readme

Obtaining a License Instance

As before, most licencing functions are handled behind the scenes, but the way you obtain a licence instance is now slightly different:
  1. The old "Connection String" concept is no longer a longer a licensing input, it is an output which can be used in licence queries.
  2. There is no longer a "Product Manufacturer" string.
  3. There is no longer a "dongle ID" string.
  4. The string format of connection parameters has changed. Curly braces {} are not used.

Therefore, this form of licensing code is obsolete:

// Create the basic simulator
Legion::LicenceSupport::Simulator_API_ConnectionString::SimAPIPublicKeyPtr pSimPublicKey;
pSimulator = CLegionSimulatorFactory::CreateSimulator( pSimPublicKey );

// Encrypt the connection string
std::string sProductManufacturer(	"{Transport Simulation System}" 	);
std::string sProductName(		"{Legion For Aimsun}"		);
std::string sProductVersion(		"{1.0.0.x}"			);
std::string sDongleNumber(		"138242792680"			);

std::string sDongleID			= std::string("{") + sDongleNumber + "}";

sConnectionString = sProductManufacturer + sProductName + sProductVersion + sDongleID;
Legion::LicenceSupport::Simulator_API_ConnectionString::Encrypt( pSimPublicKey, sConnectionString );

Use this code instead:

// Create the basic simulator. This can throw LicenceException exceptions...
Legion::Simulator::ISimulatorPtr				pSimulator;

// Product Name must be exactly “LEGION Simulator API” (case-sensitive) to use LEGION Simulator API.
// Version string must match the current API version - use the provided Licence Support function to ensure this.
std::string sProductName_In 		= "LEGION Simulator API";			
std::string sProductVersion_In 	= Legion::LicenceSupport::CLegnLicenceSupport::GetProductVersion().AsString();	

// Licence connection string's public encryption key and connection string itself.
// Use this to create a Licence Support instance for querying licence information.
Legion::LicenceSupport::Simulator_API_ConnectionString::SimAPIPublicKeyPtr	pPublicKey_Out;			
std::string							sConnectionString_Out;	

// CREATE the LEGION simulator instance here. Initialises the licence client and validates entitlement.
// Licence client must be initialised to use most licence support and simulation functions.
// This can throw LicenceException exceptions...
// Associated window (“hAssociatedWindow”) input parameter must not be null.
pSimulator = CLegionSimulatorFactory::CreateSimulator(
hAssociatedWindow_In, sProductName_In, sProductVersion_In, pPublicKey_Out, sConnectionString_Out );

Calls to CLegionSimulatorFactory::CreateSimulator() may throw Legion::Exception::LicenceException exceptions if there are licence issues, and will return an empty ISimulatorPtr.